<!--
 * @Author: xfworld
 * @Date: 2020-06-09 15:48:34
 * @LastEditors: xfworld
 * @LastEditTime: 2020-06-10 12:08:23
 * @Description: 
-->
<template>
  <div>
    <van-nav-bar
      fixed
      placeholder
      title="我的"
      left-text="修改密码"
      right-text="注销用户"
      @click-left="onClickEditPass"
      @click-right="onClickLoginOut"
    />
    <div class="header"></div>
    <van-cell-group title="信息">
      <van-cell icon="contact" title="用户" :value="user.name" />
      <van-cell icon="gold-coin-o" title="版本" value="1.4" />
    </van-cell-group>
  </div>
</template>
<script>
import {mapGetters, mapActions} from "vuex";
export default {
  name: "personIndex",
  components: {},
  mounted() {
    this.user.name = this.userData.bizUserName;
  },
  computed: {
    ...mapGetters("user", ["userData"])
  },
  data() {
    return {
      user: {
        name: "",
        warehouse: "武汉",
        storerWarehouseBrand: ""
      },
      list: ["个人资料", "切换仓库", "退出应用"]
    };
  },
  methods: {
    ...mapActions("user", ["handleLogOut"]),
    onClickLoginOut() {
      this.$dialog
        .confirm({
          title: "操作确定",
          message: "确定需要注销用户么？"
        })
        .then(() => {
          // on confirm
          this.handleLogOut().then(() => {
            this.$router.push({
              name: "login",
              replace: true
            });
          });
        });
      // this.$toast("注销");
    },
    onClickExit() {
      this.$toast("退出");
    },
    onClickEditPass() {
      this.$toast("修改");
    },
    clickHandle() {
      this.$router.push({
        name: this.$config.homeName,
        params: {
          sourceType: "me"
        }
      });
    }
  }
};
</script>

<style lang="less">
.header {
  width: 100%;
  height: 4rem;
  display: flex;
  background: url("../../../assets/image/timg.jpg") no-repeat;
  background-size: 100% 100%;
}
.user {
  &-poster {
    width: 100%;
    height: 53vw;
    display: block;
  }
  &-group {
    margin-bottom: 15px;
  }
  &-links {
    padding: 15px 0;
    font-size: 12px;
    text-align: center;
    background-color: #fff;
    .van-icon {
      display: block;
      font-size: 24px;
    }
  }
}
</style>
